
package com.lzb.compressmaster.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.compressmaster.R;
import com.lzb.compressmaster.basic.ProviderMultiAdapter;
import com.lzb.compressmaster.bean.CompressFormatBean;
import com.lzb.compressmaster.bean.GoCompressTabBean;

public class GoCompressTabAdapter extends ProviderMultiAdapter<GoCompressTabBean> {

    public GoCompressTabAdapter() {
        addItemProvider(new GoCompressTabProvider());
    }

    private class GoCompressTabProvider extends BaseItemProvider<GoCompressTabBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_go_compress_tab;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, GoCompressTabBean bean) {
            baseViewHolder.setText(R.id.tvGoCompressTabItemTitle, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.getView(R.id.ivGoCompressTabItemSel).setVisibility(View.VISIBLE);
                baseViewHolder.setTextColor(R.id.tvGoCompressTabItemTitle, Color.parseColor("#246FFE"));
            } else {
                baseViewHolder.getView(R.id.ivGoCompressTabItemSel).setVisibility(View.INVISIBLE);
                baseViewHolder.setTextColor(R.id.tvGoCompressTabItemTitle, Color.parseColor("#1A1A1A"));
            }
        }
    }

}
